package database;


import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/** The class that loads the JDBC driver returns the connection to the Database.
 * @author Team 1
 *
 */
public class DataConnection {
	
	/** Loads the JDBC driver and returns the connection to the dataBase.s3db resource.
	 * @return Connection to the database resource or null if it is not found.
	 */
	public static Connection openConection() {
		try {
			//Loads the driver.
			Class.forName("org.sqlite.JDBC").newInstance();
			//returns the connection to the resource.
			return DriverManager.getConnection("jdbc:sqlite::resource:" + DataConnection.class.getResource("dataBase.s3db"));
		} catch (ClassNotFoundException e) {
		
		} catch (SQLException e) {
		
		} catch (InstantiationException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		} catch (IllegalAccessException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
}
